# Contributor: qaqland <qaq@qaq.land>
# Maintainer: qaqland <qaq@qaq.land>
pkgname=libtbox
pkgver=1.7.6
pkgrel=0
pkgdesc="A glib-like multi-platform c library"
url="https://github.com/tboox/tbox"
arch="all"
license="Apache-2.0"
subpackages="$pkgname-dev"
makedepends="linux-headers"
source="$pkgname-$pkgver.tar.gz::https://github.com/tboox/tbox/archive/refs/tags/v$pkgver.tar.gz
	$pkgname.pc
	"
builddir="$srcdir/tbox-$pkgver"

prepare() {
	default_prepare
	chmod -x ./*.md
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--kind=shared \
		--force_utf8=yes \
		--charset=yes \
		--float=yes \
		--hash=yes
	make
}

check() {
	make run
}

package() {
	make DESTDIR="$pkgdir" install
	rm "$pkgdir/usr/bin/demo"

	mkdir -p "$pkgdir/usr/lib/pkgconfig/"
	sed "s/@VERSION@/$pkgver/" "$srcdir/$pkgname.pc" > "$pkgdir/usr/lib/pkgconfig/$pkgname.pc"
}

sha512sums="
ad8e8d46ac41eee64a91b7a9efd0a7507b29d3eff19970752452149963cb1e48c7a8706bd58272b428b04257f37d2a6600f6de578347b10907ff07fe36aaf2f9  libtbox-1.7.6.tar.gz
9b9e41014af55df80419fde320784e396a6a54005cf09393567f43ce146b94494090927fdfa2685edf3b72bc5ff4d155c99a037d4ea8c9a3cb649187ac4c9a32  libtbox.pc
"
